Skip to content

feat(gesture): pinch an element by ref or selector - #4998

Merged
thymikee merged 5 commits into
mainfrom
feat/pinch-target
Nov 23, 2026
Merged

thymikee merged 5 commits into
mainfrom
feat/pinch-target

Conversation

@thymikee

@thymikee thymikee commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

gesture pinch now takes an element in place of x/y: gesture pinch <scale> <@ref|selector> on the CLI and element on the MCP gesture tool. The element is resolved like a drag target and the pinch centers on its touch point. Refs pass drag's ref-frame admission. A recorded .ad line stores the selector, and an unresolved ref is refused at save time. element on other gesture kinds is refused.

Unknown pinch and zoom commands now suggest gesture pinch <scale> <@ref|selector>.

Reason: a pinch without coordinates lands at the screen center and misses an off-center image. Agents tried gesture pinch 2 @e17 first, then had to compute coordinates.

Before / after

Test app, iPhone 17 Pro simulator, off-center gesture image:

Call Base Head
gesture pinch 1.5 scale 1.00 (missed) same
gesture pinch 1.5 @e17 gesture origin requires both x and y coordinates scale 1.39
pinch 2 @e17 Unknown command: pinch. `…Did you mean gesture pinch <@ref

Sonnet pinch task, 4 runs per arm, all passed: CLI median 8 → 4 turns, $0.031 → $0.016. MCP median 11.5 → 6.5 turns, $0.076 → $0.044.

Validation

  • Device at 435f4bf: pinch by ref (1.00 → 1.39), selector (→ 1.92), and MCP element (→ 1.39). The saved script recorded gesture "pinch" 1.5 "id=\"gesture-target-image\"", and replaying it on a fresh app pinched (→ 1.39).
  • Head 724715b: typecheck, lint, Fallow audit, and the touched suites pass.
  • Follow-up: drag-style replay target evidence for pinch elements.

🤖 Generated with Claude Code

thymikee and others added 2 commits November 23, 2026 09:19
gesture pinch now takes an element (`gesture pinch <scale> <@ref|selector>`,
MCP `element`) in place of x/y. The runtime resolves it through the same
target resolution as drag and pinches around the element's touch point; a
recorded .ad line stores the selector, not the session ref. Without an
element or origin the pinch still centers on the screen, which misses an
off-center image.

Unknown `pinch` and `zoom` commands now suggest the gesture pinch shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…refs

element is refused on gesture kinds other than pinch instead of being
dropped, a pinch checks the backend's gesture support before resolving its
element, and a recorded pinch whose element ref never resolved to a
selector is refused at save time like an unresolved drag endpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.54 MB 6.54 MB +2.2 kB
Package (unpacked) 6.54 MB 6.54 MB +2.2 kB
Package (download) 1.99 MB 1.99 MB +565 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 19.9 ms 20.4 ms +0.5 ms
CLI --help 41.9 ms 42.1 ms +0.2 ms

thymikee and others added 2 commits November 23, 2026 09:30
… script write failure

Splits pinch payload reading out of readGesturePayload, which the change
pushed over the complexity threshold, and folds the two identical script
write failure wrappers into one helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mple

The help first screen keeps its key rules within 30 lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 3 new findings on 9fa7b72. The verdict and the full list are in the summary comment.

…tra arguments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 724715b

Since the review of 9fa7b72: 0 new · 0 still open · 3 no longer raised (2 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (a6642f37da2e).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

The code is ready at 724715b. Checks are still running: Smoke Tests (macos) and one other check are in progress, and none has failed yet. Smoke Tests cover the CLI gesture routes this diff touches, so a failure there would need a closer look. There are no conflicts. Device evidence comes from an earlier commit (435f4bf) on an iPhone 17 Pro simulator; the device-facing code is unchanged since then by diff. Not verified here: Android element pinch, local test runs, and whether replay heal or repair treats pinch selectors specially.

Not blocking, take or leave: (1) gesture-command.ts:98 copies the drag token-to-target mapping and point check, so one shared gesture-target resolver would stop the two from drifting; (2) a replayed pinch on an element skips the replay target check that drag gets in interaction-gesture.ts:154, which fits a follow-up issue; (3) the unresolved-ref refusal at save time in session-script-writer.ts:394 only applies to repair-armed or publishing writes, the same as drag, and has no typed reason yet; (4) no daemon-level test drives a pinch on @eN through the recorded positionals; (5) a text selector that looks like a number, such as 2024, reads as an x coordinate unless written text="2024".

Of the earlier inline threads, the one on the refusal text is fixed at this commit (#4998 (comment)), and the one on extra pinch arguments is fixed too (#4998 (comment)). The one on pinch 2 100 does not apply, because that claim was withdrawn and the partial-origin error is correct (#4998 (comment)). Please resolve all three. Once Smoke Tests (macos) finish green, this can merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 23, 2026
@thymikee
thymikee merged commit a056092 into main Nov 23, 2026
22 checks passed
@thymikee
thymikee deleted the feat/pinch-target branch November 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant